package com.miao.edu.user.controller;

import com.miao.edu.user.api.UserRemoteService;
import com.miao.edu.user.dto.UserDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author: niemiao
 * @date: 2021/7/27
 **/
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserRemoteService userRemoteService;



    @GetMapping("/getUserByPhone")
    public UserDTO getUserByPhone(@RequestParam("phone") String phone) {
        return this.userRemoteService.getUserByPhone(phone);
    }

    @GetMapping("/isRegister")
    public boolean isRegister(@RequestParam("phone") String phone) {
        return this.userRemoteService.isRegister(phone);
    }


    @PostMapping("/saveUser")
    public UserDTO save(@RequestBody UserDTO userDTO) {
        return userRemoteService.saveUser(userDTO);
    }

}
